export default {
    namespaced: true,
    state: () => {
        return {
            userinfo: {
                token: '123',
                username: '张三'
            }
        }
    },
    mutations: { //同步操作，修改
        updateName(state,payload){
            state.userinfo.username = payload;
        }
    },
    actions: { //异步，可以发送请求
        updateNameAsync({commit},payload){
            setTimeout(() => {
                commit('updateName',payload)
            }, 2000);
        }
    }
}